<?php

namespace app\adminapi\validate\reimbursement;

use app\common\validate\BaseValidate;

class ExpenseTypeValidate extends BaseValidate
{
    protected $rule = [
        'id' => 'require|number',
        'name' => 'max:50',
        'status' => 'in:0,1',
    ];

    protected $message = [
        'id.require' => '请选择要操作的记录',
        'id.number' => '请选择要操作的记录',
        'name.max' => '名称长度不能超过50个字符',
        'status.in' => '状态值错误',
    ];

    /**
     * 添加场景
     */
    public function sceneAdd()
    {
        return $this->remove('id', true);
    }

    /**
     * 编辑场景
     */
    public function sceneEdit()
    {
        return $this->only(['id', 'name', 'status']);
    }

    /**
     * ID场景
     */
    public function sceneId()
    {
        return $this->only(['id']);
    }
}